Index: tcc-0.9.25/Makefile
===================================================================
--- tcc-0.9.25.orig/Makefile
+++ tcc-0.9.25/Makefile
@@ -13,6 +13,10 @@ ifneq ($(GCC_MAJOR),2)
 CFLAGS+=-fno-strict-aliasing
 endif
 
+ifndef ($(DESTDIR))
+DESTDIR = /
+endif
+
 ifeq ($(ARCH),i386)
 CFLAGS+=-mpreferred-stack-boundary=2
 ifeq ($(GCC_MAJOR),2)
@@ -197,48 +201,48 @@ INSTALL=install
 
 ifndef CONFIG_WIN32
 install: $(PROGS) $(LIBTCC1) $(BCHECK_O) libtcc.a tcc.1 tcc-doc.html
-	mkdir -p "$(bindir)"
-	$(INSTALL) -s -m755 $(PROGS) "$(bindir)"
-	mkdir -p "$(mandir)/man1"
-	$(INSTALL) tcc.1 "$(mandir)/man1"
-	mkdir -p "$(tccdir)"
-	mkdir -p "$(tccdir)/include"
+	mkdir -p "$(DESTDIR)/$(bindir)"
+	$(INSTALL) -s -m755 $(PROGS) "$(DESTDIR)/$(bindir)"
+	mkdir -p "$(DESTDIR)/$(mandir)/man1"
+	$(INSTALL) tcc.1 "$(DESTDIR)/$(mandir)/man1"
+	mkdir -p "$(DESTDIR)/$(tccdir)"
+	mkdir -p "$(DESTDIR)/$(tccdir)/include"
 ifneq ($(LIBTCC1),)
-	$(INSTALL) -m644 $(LIBTCC1) "$(tccdir)"
+	$(INSTALL) -m644 $(LIBTCC1) "$(DESTDIR)/$(tccdir)"
 endif
 ifneq ($(BCHECK_O),)
-	$(INSTALL) -m644 $(BCHECK_O) "$(tccdir)"
+	$(INSTALL) -m644 $(BCHECK_O) "$(DESTDIR)/$(tccdir)"
 endif
-	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
-	mkdir -p "$(docdir)"
-	$(INSTALL) -m644 tcc-doc.html "$(docdir)"
-	mkdir -p "$(libdir)"
-	$(INSTALL) -m644 libtcc.a "$(libdir)"
-	mkdir -p "$(includedir)"
-	$(INSTALL) -m644 libtcc.h "$(includedir)"
+	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(DESTDIR)/$(tccdir)/include"
+	mkdir -p "$(DESTDIR)/$(docdir)"
+	$(INSTALL) -m644 tcc-doc.html "$(DESTDIR)/$(docdir)"
+	mkdir -p "$(DESTDIR)/$(libdir)"
+	$(INSTALL) -m644 libtcc.a "$(DESTDIR)/$(libdir)"
+	mkdir -p "$(DESTDIR)/$(includedir)"
+	$(INSTALL) -m644 libtcc.h "$(DESTDIR)/$(includedir)"
 
 uninstall:
-	rm -fv $(foreach P,$(PROGS),"$(bindir)/$P")
-	rm -fv $(foreach P,$(LIBTCC1) $(BCHECK_O),"$(tccdir)/$P")
-	rm -fv $(foreach P,$(TCC_INCLUDES),"$(tccdir)/include/$P")
-	rm -fv "$(docdir)/tcc-doc.html" "$(mandir)/man1/tcc.1"
-	rm -fv "$(libdir)/libtcc.a" "$(includedir)/libtcc.h"
+	rm -fv $(foreach P,$(PROGS),"$(DESTDIR)/$(bindir)/$P")
+	rm -fv $(foreach P,$(LIBTCC1) $(BCHECK_O),"$(DESTDIR)/$(tccdir)/$P")
+	rm -fv $(foreach P,$(TCC_INCLUDES),"$(DESTDIR)/$(tccdir)/include/$P")
+	rm -fv "$(DESTDIR)/$(docdir)/tcc-doc.html" "$(DESTDIR)/$(mandir)/man1/tcc.1"
+	rm -fv "$(DESTDIR)/$(libdir)/libtcc.a" "$(includedir)/libtcc.h"
 
 else
 install: $(PROGS) $(LIBTCC1) libtcc.a tcc-doc.html
-	mkdir -p "$(tccdir)"
-	mkdir -p "$(tccdir)/lib"
-	mkdir -p "$(tccdir)/include"
-	mkdir -p "$(tccdir)/examples"
-	mkdir -p "$(tccdir)/doc"
-	mkdir -p "$(tccdir)/libtcc"
-	$(INSTALL) -s -m755 $(PROGS) "$(tccdir)"
-	$(INSTALL) -m644 $(LIBTCC1) win32/lib/*.def "$(tccdir)/lib"
-	cp -r win32/include/. "$(tccdir)/include"
-	cp -r win32/examples/. "$(tccdir)/examples"
-#	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
-	$(INSTALL) -m644 tcc-doc.html win32/tcc-win32.txt "$(tccdir)/doc"
-	$(INSTALL) -m644 libtcc.a libtcc.h "$(tccdir)/libtcc"
+	mkdir -p "$(DESTDIR)/$(tccdir)"
+	mkdir -p "$(DESTDIR)/$(tccdir)/lib"
+	mkdir -p "$(DESTDIR)/$(tccdir)/include"
+	mkdir -p "$(DESTDIR)/$(tccdir)/examples"
+	mkdir -p "$(DESTDIR)/$(tccdir)/doc"
+	mkdir -p "$(DESTDIR)/$(tccdir)/libtcc"
+	$(INSTALL) -s -m755 $(PROGS) "$(DESTDIR)/$(tccdir)"
+	$(INSTALL) -m644 $(LIBTCC1) win32/lib/*.def "$(DESTDIR)/$(tccdir)/lib"
+	cp -r win32/include/. "$(DESTDIR)/$(tccdir)/include"
+	cp -r win32/examples/. "$(DESTDIR)/$(tccdir)/examples"
+#	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(DESTDIR)/$(tccdir)/include"
+	$(INSTALL) -m644 tcc-doc.html win32/tcc-win32.txt "$(DESTDIR)/$(tccdir)/doc"
+	$(INSTALL) -m644 libtcc.a libtcc.h "$(DESTDIR)/$(tccdir)/libtcc"
 endif
 
 # documentation and man page
